/**
 * 
 */
package com.bitBusy.manageyourriches.alarmSystem;

import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.bitBusy.manageyourriches.activity.AlarmActivity;
import com.bitBusy.manageyourriches.database.contactClasses.PaymentReminder;

public class AlarmManagerBroadcastReceiver extends BroadcastReceiver {

	final public static String ONE_TIME = "onetime";
	
 @Override
 public void onReceive(Context the_context, Intent intent) {
	 
         Intent service = new Intent(the_context, AlarmReceiverService.class);
     //    service.putExtra(AlarmActivity.ALARMTEXT, intent.getStringExtra(AlarmActivity.ALARMTEXT));
         service.putExtra(AlarmActivity.ALARMDETAILS, (PaymentReminder)intent.getExtras().getParcelable(AlarmActivity.ALARMDETAILS));
         the_context.startService(service);
     }
 
    public void CancelAlarm(Context context)
   {

        Intent intent = new Intent(context, AlarmManagerBroadcastReceiver.class);
        PendingIntent sender = PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_ONE_SHOT);
        AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
        alarmManager.cancel(sender);
    }


}
